
/*
 * GET home page.
 */

exports.index = function(req, res){
  var ipaddr = req.connection.remoteAddress;
  var iplist = [
                 ["172.16.33.150", "wakayama"],
                 ["172.16.33.121", "harada"],
                 ["172.16.33.103", "ayashiro"],
                 ["172.16.33.102", "kurita"],
                 ["172.16.34.6",   "iguchi"],
                 ["172.16.34.5",   "hirayu"],
               ];

  for (var i = 0; i < iplist.length; i ++){
    if(ipaddr == iplist[i][0]){
      res.render('index', { title: 'node.js', user: iplist[i][1] });
    }
  }

  //res.render('404', { title: 'file not found (HTTP/404)' });
  //if(ipaddr == iplist[0]){
  //  res.render('index', { title: 'node.js', ip: ipaddr, user: iplist[0] });
  //}else{
  //  res.render('404', { title: 'file not found (HTTP/404)' });
  //}
  //res.render('index', { title: 'Sample02', ip: ipaddr });
};
